<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<?php view_include('admin/inc_head') ?>
	<title><?php echo page_title( '用户列表' ) ?></title>
	<script type="text/javascript">
		function user_change_status( id, change_status ) {
			$.get(
				'<?php echo site_url('admin/user/change_status/') ?>/'+id+'/'+change_status,
				function( data ){
					if( data.status ){
						location.reload();
					}
				}, "json"
			);
		}
		function is_promotion_status( id ) {
			$.get(
				'<?php echo site_url('admin/user/is_promotion_status/') ?>/'+id,
				function( data ){
					if( data.status ){
						location.reload();
					}
				}, "json"
			);
		}
	</script>
</head>
<body>
<?php view_include('admin/inc_topbar') ?>
<div class="container-fluid">
	<!--侧栏导航-->
	<?php view_include('admin/inc_sidebar') ?>
	<!--主体-->
	<div class="main">
		<!--侧栏子导航-->
		<?php view_include('admin/inc_navbar') ?>
		<!--主体内容-->
		<div class="console-container">
			<div class="console-body">
				<div class="secure">
					<div class="console-title console-title-border clearfix">
						<h5>用户列表</h5>
						<p></p>
					</div>
					<div class="margin-top2 clearfix">
						<div class="search-form clearfix">
							<form class="form-inline" action="<?php echo site_url('admin/user/ls/'.$state) ?>" method="get">
								<div class="col-sm-9" style="padding:0;">
									<div class="form-group">
										<input name="sk_nickanme" type="text"
										       placeholder="昵称搜索" class="ipt form-control"
										       value="<?php echo $sk_nickanme ? $sk_nickanme : '' ?>">
										&nbsp;&nbsp;&nbsp;&nbsp;
										<input name="sk_mobile" type="text"
										       placeholder="手机号码搜索" class="ipt form-control"
										       value="<?php echo $sk_mobile ?>">
										&nbsp;&nbsp;&nbsp;&nbsp;
										<input name="sk_uid" type="text"
										       placeholder="用户ID搜索" class="ipt form-control"
										       value="<?php echo $sk_uid ? $sk_uid : '' ?>">
										<input type="submit" class="btn btn-default" value="搜索" />
									</div>
								</div>
								<div class="col-sm-3 text-right" style="padding:0;">
								</div>
							</form>
						</div>
					</div>

					<div class="margin-top2 clearfix">
						总人数：<?php echo db_count_record_num('user_bwc', '1=1')?>
					</div>
					<?php
					if( $user_list ) {
						?>
						<div class="margin-top2">
							<table class="table table-bordered">
								<thead>
								<tr>
									<th>ID</th>
									<th>头像昵称</th>
									<th>手机</th>
									<th>时间</th>
								</tr>
								</thead>
								<tbody>
								<?php
								foreach( $user_list as $k => $v ) {
									$head_img = $v['headimgurl'] ? $v['headimgurl'] : base_url('assets/images/no.jpg');
									$nickname = $v['nickname'] ? $v['nickname'] : '';
									?>
									<tr>
										<td>#<?php echo $v['id']?></td>
										<td><img style="width:40px;" src="<?php echo $head_img ?>" />&nbsp;&nbsp;<?php echo $nickname ?></td>
                                        <td><?php echo $v['mobile'] ? $v['mobile'] : '未填' ?></td>
										<td><?php echo date('Y-m-d H:i', $v['subscribe_time']);?></td>
									</tr>
									<?php
								}
								?>
								</tbody>
								<?php
								if( $page ) {
									?>
									<tfoot>
									<tr>
										<td colspan="7" class="text-right">
											<nav><?php echo $page ?></nav>
										</td>
									</tr>
									</tfoot>
									<?php
								}
								?>
							</table>
						</div>
						<?php
					} else {
						?>
						<div class="margin-top2">
							<h5 class="text-danger">暂无数据</h5>
						</div>
						<?php
					}
					?>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
</html>